package edu.com.javeriana.aes.gestion.fundacion.ejb;

import edu.com.javeriana.aes.gestion.fundacion.entity.Usuario;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author gersua
 */
@Stateless
public class AdministrarEstudiantes implements AdministrarEstudiantesLocal {

    
    @PersistenceContext(unitName = "FundacionDEL-ejbPU")
    private EntityManager entityManager;
    
    public Collection<Usuario> consultarEstudiantes() {
        Query query = entityManager.createQuery("SELECT u FROM Usuario u WHERE u.roleIdRole.idRole = :idRole");
        query.setParameter("idRole", 2);
        return query.getResultList();
    }
}
